package com.zhangchangyuan.importdata;

import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class ImportFromSqlFile {
    public static void main(String[] args) {
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;

        try{
            Class.forName("com.mysql.cj.jdbc.Driver");
            conn = DriverManager.getConnection(
                    "jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8&useSSL=false", "root",
                    "123456");

            String sql = "insert into pcore_banner(news_id,image,stick,status,create_time,update_time,status_time) "+
                    "values(1,'/image/1.jpg',1,0,0,0,0)";
            stmt =conn.createStatement();
            int rows = stmt.executeUpdate(sql);

            System.out.println("rows="+rows);


        }catch (Exception e){
            System.out.println("凉凉");
            System.out.println(e.getMessage());
        }


    }
}
